public class Temperature {
	public enum Unit{
		FAHRENHEIT,
		CELSIUS,
		KELVIN
	}
	
	public static double convert(Unit start, Unit end, double value){
		if(start == end) return value;
		switch(start) {
			case CELSIUS:
				switch(end) {
					case FAHRENHEIT:
						return (value*9.0/5.0)+32.0;
					case KELVIN:
						return value + 272.15;
				}
			case FAHRENHEIT:
				switch(end) {
					case CELSIUS:
						return (value-32)*(5.0/9.0);
					case KELVIN:
						return (value-32)*(5.0/9.0) + 273.15;
				}
				break;
			case KELVIN:
				switch(end) {
					case CELSIUS:
						return value - 273.15;
					case FAHRENHEIT:
						return ((value - 273.15)*9.0/5.0)+32.0;
				}
				break;
		}
		return 0;
	}
}